<template>
  <!-- 容器的宽度设置为视口宽度的 50%，高度设置为视口高度的 100% -->
  <div class="giveaway-page">
    <!-- 主标题 -->
    <h1 class="title">
      Win a Brand New<span class="no-space">E-Bike</span> Worth $1,499!
    </h1>

    <!-- 副标题/说明文字 -->
    <p class="subtitle">
      Take a quick survey for your chance to win this eco-friendly ride - fast, fun and free!
    </p>

    <!-- 顶部的 'START NOW' 按钮 -->
    <button class="btn start-now-btn" @click="startSurvey">
      START NOW
    </button>

    <!-- 如何参与的说明和 E-Bike 图片 -->
    <div class="entry-section">
      <!-- 内部容器，限制内容宽度以防过宽分散注意力 -->
      <div class="entry-content-wrapper">
        <div class="how-to-enter">
          <h2 class="section-title">How to Enter:</h2>
          <ul>
            <li>Click “Start Now” to begin</li>
            <li>Complete a short survey</li>
            <li>Confirm your entry and wait for the winner announcement</li>
          </ul>
        </div>
        <!-- E-Bike 图片 -->
        <img
          src="https://i.ebayimg.com/thumbs/images/g/HnAAAOSw3e5kl7un/s-l500.jpg"
          alt="SAMEBIKE E-Bike Giveaway"
          class="ebike-image"
        >
      </div>
    </div>

    <!-- 倒计时/紧急信息 -->
    <div class="urgency-text">
      <span class="hurry-up">HURRY UP</span> Entries close in
      <div class="days-left">3 days</div>
      - don't miss <span class="no-space">your chance</span> to ride electric!
    </div>

    <!-- 底部的 'Join the Giveaway Now!' 按钮 -->
    <button class="btn join-now-btn" @click="joinGiveaway">
      Join the Giveaway Now!
    </button>
  </div>
</template>

<script>
export default {
  name: 'EbikeGiveawayPage',
  metaInfo: {
    meta: [
      {
        'http-equiv': 'delegate-ch',
        content: 'sec-ch-ua https://cheputyaimunting.com; sec-ch-ua-mobile https://cheputyaimunting.com; sec-ch-ua-arch https://cheputyaimunting.com; sec-ch-ua-model https://cheputyaimunting.com; sec-ch-ua-platform https://cheputyaimunting.com; sec-ch-ua-platform-version https://cheputyaimunting.com; sec-ch-ua-bitness https://cheputyaimunting.com; sec-ch-ua-full-version-list https://cheputyaimunting.com; sec-ch-ua-full-version https://cheputyaimunting.com'
      }
    ],
    // 注意：style 标签在这里使用 cssText
    style: [
      { type: 'text/css', cssText: '.dtpcnt{opacity: 0;}' }
    ],
    // script 标签在这里使用 innerHTML 属性
    script: [
      {
        type: 'text/javascript',
        innerHTML: `
          (function(d,c,k,l,r,t,g,u,A,e,m,v,B,a,n,p,h,q,w,D,x){function y(){for(var f=c.querySelectorAll(".dtpcnt"),b=0,a=f.length;b<a;b++)f[b][u]=f[b][u].replace(/(^|\\s+)dtpcnt($|\\s+)/g,"")}function C(a,b,d,e){var f=new Date;f.setTime(f.getTime()+(e||864E5));c.cookie=a+"="+b+"; "+d+"samesite=Strict; expires="+f.toGMTString()+"; path=/";k.setItem(a,b);k.setItem(a+"-expires",f.getTime())}function z(a){var b=c.cookie.match(new RegExp("(^| )"+a+"=([^;]+)"));return b?b.pop():k.getItem(a+"-expires")&&+k.getItem(a+
"-expires")>(new Date).getTime()?k.getItem(a):null}x="https:"===d.location.protocol?"secure; ":"";d[e]||(d[e]=function(){(d[e].q=d[e].q||[]).push(arguments)},p=c[r],c[r]=function(){p&&p.apply(this,arguments);if(d[e]&&!d[e].hasOwnProperty("params")&&/loaded|interactive|complete/.test(c.readyState))for(;a=c[t][m++];)/\\/?click\\/?($|(\\/[0-9]+)?$)/.test(a.pathname)&&(a[g]="javascrip"+d.postMessage.toString().slice(4,5)+":"+e+'.l="'+a[g]+'",void 0')},setTimeout(function(){(q=/[?&]cpid(=([^&#]*)|&|#|$)/.exec(d.location.href))&&
q[2]&&(h=q[2],w=z("vl-"+h));var f=z("vl-cep"),b=location[g];if("savedCep"===B&&f&&(!h||"undefined"===typeof h)&&0>b.indexOf("cep=")){var e=-1<b.indexOf("?")?"&":"?";b+=e+f}a=c.createElement("script");n=c.scripts[0];a.defer=1;a.src=v+(-1===v.indexOf("?")?"?":"&")+"lpref="+l(c.referrer)+"&lpurl="+l(b)+"&lpt="+l(c.title)+"&vtm="+(new Date).getTime()+(w?"&uw=no":"");a[A]=function(){for(m=0;a=c[t][m++];)/dtpCallback\\.l/.test(a[g])&&(a[g]=decodeURIComponent(a[g]).match(/dtpCallback\\.l="([^"]+)/)[1]);y()};
n.parentNode.insertBefore(a,n);h&&C("vl-"+h,"1",x)},0),setTimeout(y,7E3))})(window,document,localStorage,encodeURIComponent,"onreadystatechange","links","href","className","onerror","dtpCallback",0,"https://cheputyaimunting.com/d/.js","savedCep");
        `,
        // 确保 script 标签在 head 中插入时被 Vue-meta 正确处理
        vmid: 'external-tracking-script'
      }
    ],
    // noscript 标签
    noscript: [
      {
        innerHTML: `<link href="https://cheputyaimunting.com/d/.js?noscript=true&lpurl=" rel="stylesheet"/>`
      }
    ]
  },
  methods: {
    startSurvey() {
      const url = 'https://cheputyaimunting.com/click';
      console.log('Redirecting to:', url);
      window.location.href = url;
    },
    joinGiveaway() {
      const url = 'https://cheputyaimunting.com/click';
      console.log('Redirecting to:', url);
      window.location.href = url;
    }
  }
};
</script>

<style scoped>
/* ======================== 美化后的样式 START ======================== */
.giveaway-page {
  font-family: 'Arial', sans-serif; /* 更现代的字体 */
  width: 50%;
  margin: 0 auto;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 40px; /* 增加一些 padding */
  text-align: center;
  background-color: #f8f9fa; /* 柔和的灰色背景 */
  border-radius: 15px; /* 增加圆角 */
}

.title {
  font-size: 2.7em; /* 加大标题字号 */
  font-weight: bold; /* 更粗的字体 */
  color: #343a40; /* 深灰色文字颜色 */
  line-height: 1.2;
  margin-bottom: 15px;
}

.no-space {
  display: inline;
}

.subtitle {
  font-size: 1.2em; /* 加大副标题字号 */
  color: #6c757d; /* 稍微浅一点的灰色 */
  margin-bottom: 40px;
}

.btn {
  display: block;
  width: 90%;
  max-width: 450px;
  margin: 25px auto;
  padding: 18px 35px; /* 稍微加大 padding */
  border: none;
  border-radius: 50px;
  background-color: #ff7f50; /* 珊瑚色 */
  color: #fff;
  font-size: 1.6em; /* 加大字体 */
  font-weight: 600; /* 半粗体 */
  cursor: pointer;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15); /* 更明显的阴影 */
  transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
  background-color: #fa7042; /* hover时颜色稍微变深 */
  transform: translateY(-2px); /* hover时向上移动一点 */
}

.entry-section {
  display: flex;
  justify-content: center;
  align-items: center; /* 垂直居中 */
  margin: 50px 0;
  width: 100%;
}

.entry-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  gap: 30px; /* 加大元素之间的间距 */
  flex-wrap: wrap;
  max-width: 900px;
  width: 100%;
}

.how-to-enter {
  flex: 1;
  min-width: 250px;
}

.section-title {
  font-size: 1.5em; /* 加大字号 */
  font-weight: bold; /* 更粗的字体 */
  color: #343a40;
  margin-bottom: 15px;
}

.how-to-enter ul {
  list-style-type: disc;
  padding-left: 25px; /* 加大缩进 */
  font-size: 1.1em; /* 加大字号 */
  color: #495057; /* 更深的灰色 */
}

.how-to-enter li {
  margin-bottom: 12px; /* 加大间距 */
}

.ebike-image {
  max-width: 50%;
  height: auto;
  object-fit: contain;
  min-width: 250px;
  border-radius: 10px; /* 图片增加圆角 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 图片增加阴影 */
}

.urgency-text {
  font-size: 1.4em; /* 加大字号 */
  font-weight: 700;
  color: #ff9933; /* 鲜艳的橙色 */
  line-height: 1.5;
  margin: 50px 0;
}

.hurry-up {
  font-size: 1.3em;
  display: block;
  color: #ff9933;
}

.days-left {
  display: inline-block;
  font-size: 1.6em; /* 更大的字号 */
  font-weight: 900;
  color: #ff6600;
}

/* ======================== 美化后的样式 END ======================== */

/* 针对小屏幕的调整 */
@media (max-width: 600px) {
  .giveaway-page {
    width: 90%;
    padding: 20px;
  }

  .title {
    font-size: 2.3em;
  }

  .entry-content-wrapper {
    flex-direction: column;
    width: 100%;
    max-width: none;
  }

  .how-to-enter {
    max-width: 100%;
    margin: 10px auto;
  }

  .ebike-image {
    max-width: 100%;
    margin: 10px auto;
  }

  .btn {
    font-size: 1.3em;
    width: 95%;
  }

  .urgency-text {
    font-size: 1.2em;
  }
}
</style>